package com.iflytek.uc.dao.impl;

import org.hibernate.Query;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.iflytek.uc.dao.ConfigDao;
import com.iflytek.uc.po.PoConfig;

public class ConfigDaoImpl extends HibernateDaoSupport implements ConfigDao {

	public String getValue(String name) {
		Query query = getSession().createQuery("from PoConfig where name=:name");
		query.setString("name", name);
		PoConfig config = (PoConfig)query.uniqueResult();
		
		return config.getValue();
	}

	public void updateValue(String name, String value) {
		Query query = getSession().createQuery("update PoConfig set value=:value where name=:name");
		query.setString("name", name);
		query.setString("value", value);
		query.executeUpdate();
	}

}
